<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String path = request.getContextPath();
String basepath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>编辑商铺面积信息</title>
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
    <meta content="black" name="apple-mobile-web-app-status-bar-style" />
    <meta content="telephone=yes" name="format-detection" />
    <link href="<%=basepath%>css/index.css" rel="stylesheet" type="text/css">
    <link href="<%=basepath%>css/platform.css" rel="stylesheet" type="text/css">
    <script src="<%=basepath%>js/jquery-1.8.3.min.js"></script>
    <script src="<%=basepath%>js/layer/layer.js"></script>
</head>
<body>
<div class="viewport">
    <div class="header">
       <div class="header-1">
           <a href="javascrpt:void(0)" id="join" class="header-2">
              <span id="account" class="account">${empty user.realName ? '' : user.realName}</span>&nbsp;&nbsp;<span id="deptName" class="deptName">${user.departmentName}</span>
           </a>
           <a href="/wape-web/api/core/centerService?serviceCode=WJ9999&targetURL=store&prefix=3g_platform_shop-rent_op&entrance=yes" class="back" id="back">返回</a>
           <span class="span-num">WMP32110</span>
       </div>
    </div>
    <div class="content m-top">
        <div class="blank"></div>
        <div class="layout3-1">
            <div class="layout3-1-1"><span>${topMarket}</span>&nbsp;&nbsp;&nbsp;&nbsp;<span>场内商铺</span><span style="float:right;">棚区总面积：<b>${fatherTotalArea}</b>&nbsp;m²</span></div>
            <div class="hr"></div>
            <div class="layout3-1-1"><span><b>${store.fatherName}</b>&nbsp;&nbsp;&nbsp;&nbsp;<b>${store.storeName}</b>&nbsp;号</span><span style="float:right;">棚区内商铺数量：<b>${fatherRemark}</b>&nbsp;个</span></div>
            <div class="hr"></div>
        </div>
        <div class="blank"></div>
        <div class="layout3-2">
            <div class="layout3-2-1"><a href="javascript:void(0)" id="rentalArea" class="a4-1"><span style="float:left;" class="title">租/售计量面积：</span><b class="text" style="min-width:12px;display:inline-block;">${store.rentalArea}</b> m²<img alt="" src="<%=basepath%>images/b43.png" style="float:right;width:40px;"></a></div>
            <div class="hr"></div>
            <div class="layout3-2-1">
                <a href="javascript:void(0)">
                    <span style="float:left;" class="title">商铺类型：</span>
                    <select style="border:none;width:78%;" id="select">
                        <option value="10" ${store.storeType eq '10' ? 'selected' : ''}>自营</option>
                        <option value="20" ${store.storeType eq '20' ? 'selected' : ''}>场内商铺</option>
                    </select>
                </a>
            </div>
            <div class="hr"></div>
            <div class="layout3-2-1"><a href="javascript:void(0)" id="usableArea" class="a4-1"><span style="float:left;" class="title">商铺使用面积：</span><b class="text" style="min-width:12px;display:inline-block;">${store.usableArea}</b> m²<img alt="" src="<%=basepath%>images/b43.png" style="float:right;width:40px;"></a></div>
            <div class="hr"></div>
            <div class="layout3-2-1"><a href="javascript:void(0)" id="poolArea" class="a4-1"><span style="float:left;" class="title">商铺公摊面积：</span><b class="text" style="min-width:12px;display:inline-block;">${store.poolArea}</b> m²<img alt="" src="<%=basepath%>images/b43.png" style="float:right;width:40px;"></a></div>
            <div class="hr"></div>
            <div class="layout3-2-1"><a href="javascript:void(0)" id="packingCount" class="a4-1"><span style="float:left;" class="title">商铺专用车位数量：</span><b class="text" style="min-width:12px;display:inline-block;">${store.packingCount}</b> 个<img alt="" src="<%=basepath%>images/b43.png" style="float:right;width:40px;"></a></div>
            <div class="hr"></div>
            <div class="layout3-2-1"><a href="javascript:void(0)" id="packingArea" class="a4-1"><span style="float:left;" class="title">商铺专用车位总面积：</span><b class="text" style="min-width:12px;display:inline-block;">${store.packingArea}</b> m²<img alt="" src="<%=basepath%>images/b43.png" style="float:right;width:40px;"></a></div>
            <div class="hr"></div>
            <div class="layout3-2-1"><a href="javascript:void(0)" id="otherArea" class="a4-1"><span style="float:left;" class="title">其他经营区域面积：</span><b class="text" style="min-width:12px;display:inline-block;">${store.otherArea}</b> m²<img alt="" src="<%=basepath%>images/b43.png" style="float:right;width:40px;"></a></div>
            <div class="hr"></div>
        </div>
        <div class="blank-z"></div>
        <div class="layout3-1">
            <div class="layout3-1-1"><span style="font-size:14px;font-weight:bold;">其他面积信息</span></div>
        </div>
        <div class="blank"></div>
        <div class="layout3-2">
            <c:forEach items="${prop}" var="po">
                <div class="layout3-2-1"><a href="javascript:void(0)" id="${po.storePropId}" class="a4-2"><span style="float:left;" class="text">${po.propValue}</span> <img alt="" src="<%=basepath%>images/b43.png" style="float:right;width:40px;"></a></div>
                <div class="hr"></div>
            </c:forEach>
            <div class="blank-b" id="other2"></div>
            <div class="content-4-1" style="text-align:center;"><a href="javascript:void(0)" id="other" style="font-size:20px;width:100%;display:inline-block;">✚</a></div>
        </div>
        <div class="space"></div>
    </div>
</div>
</body>
<script type="text/javascript">
    /*错误提示*/
    $(function(){
        var error = "${requestScope.returnMsg}";
        if(error != "" && error != "成功!"){
            layer.msg(error,{shadeClose:true,shade:0.1,time:2000});
        }
    });
    /*编辑*/
    $(function(){
        /*  */
        $(".a4-1").click(function(){
            var title = $(this).children(".title").text();
            var title2 = $(this).children(".text");
            var storeId = '${store.storeId}';
            var sname = $(this).attr("id");
            var rentalArea;
            var usableArea;
            var poolArea;
            var packingCount;
            var packingArea;
            var otherArea;
            layer.prompt({formType:0,title:title},function(index){
                if(index != ""){
                    layer.load();
                    if(sname == 'rentalArea'){
                    	rentalArea = index;
                    }
                    if(sname == 'usableArea'){
                    	usableArea = index;
                    }
                    if(sname == 'poolArea'){
                    	poolArea = index;
                    }
                    if(sname == 'packingCount'){
                    	packingCount = index;
                    }
                    if(sname == 'packingArea'){
                    	packingArea = index;
                    }
                    if(sname == 'otherArea'){
                    	otherArea = index;
                    }
                    layer.closeAll();
                    title2.text(index);
                     $.ajax({
	                     type:"post",
	                     url:"/wape-web/api/core/centerService",
	                     data:{
		                     serviceCode:"MMZS21206",
		                     storeId:storeId,
		                     rentalArea:rentalArea,
		                     usableArea:usableArea,
		                     poolArea:poolArea,
		                     packingCount:packingCount,
		                     packingArea:packingArea,
		                     otherArea:otherArea
	                     },
	                     success:function(data){
	                     var add = eval("("+data+")");
	                     if(add.returnCode == "200"){
	                     title2.text(index);
	                     }
	                     else{
	                     layer.msg(add.returnMsg,{shadeClose:true,shade:0.1,time:2000});
	                     }
	                     }
                     }); 
                }
            });
        });
        /*  */
        $(document).on('click','.a4-2',function(){
            var title3 = $(this).children(".text");
            var spid = $(this).attr("id");
            layer.prompt({formType:0,title:"其他面积信息"},function(index2){
                layer.load();
                layer.closeAll();
                title3.text(index2);
                 $.ajax({
	                 type:"post",
	                 url:"/wape-web/api/core/centerService",
	                 data:{
	                	  serviceCode:"MMZS21208",
	                	  storePropId:spid,
	                	  propName:index2,
	                	  propValue:index2
	                 },
	                 success:function(data){
	                 var add2 = eval("("+data+")");
	                 if(add2.returnCode == "200"){
	                 title3.text(index2);
	                 }
	                 else{
	                 layer.msg(add2.returnMsg,{shadeClose:true,shade:0.1,time:2000});
	                 }
	                 }
                 }); 
            });
        });
        /*添加*/
        $("#other").click(function(){
            layer.prompt({formType:0,title:"添加其他面积信息"},function(index3){
                if(index3 != ""){
                	layer.load();
                	var storeId = '${store.storeId}';
                    layer.closeAll();
                    $.ajax({
                        type:"post",
                        url:"/wape-web/api/core/centerService",
                        data:{
                            serviceCode:"MMZS21207",
                            storeId:storeId,
                            propName:index3,
                            propValue:index3
                        },
                        success:function(data){
                            var add3 = eval("("+data+")");
                            var spid = add3.result.storePropId;
                            if(add3.returnCode == "200"){
                            	layer.closeAll();
                            	$("#other2").before("<div class='layout3-2-1'><a href='javascript:void(0)' id='" + spid + "' class='a4-2'><span style='float:left;' class='text'>"+index3+"</span><img alt='' src='<%=basepath%>images/b43.png' style='float:right;width:40px;'></a></div><div class='hr'></div>");
                            }
                            else{
                            	layer.closeAll();
                                layer.msg(add3.returnMsg,{shadeClose:true,shade:0.1,time:2000});
                            }
                        }
                    });
                }

            });
        });
        /*  */
        $("#select").change(function(){
        	var storeType = $(this).val();
        	var storeId = '${store.storeId}';
        	layer.load();
        	$.ajax({
        		type:"post",
                url:"/wape-web/api/core/centerService",
                data:{
                    serviceCode:"MMZS21206",
                    storeId:storeId,
                    storeType:storeType
                },
                success:function(data){
                    var add4 = eval("("+data+")");
                    if(add4.returnCode == "200"){
                    	layer.closeAll();
                    }
                    else{
                    	layer.closeAll();
                        layer.msg(add4.returnMsg,{shadeClose:true,shade:0.1,time:2000});
                    }
                }
        	})
        });
    });
</script>
</html>


